Merge pull request #9007 from iNavFlight/MrD_Yet-another-fix-due-to-DJIs-fucking...
[inav.git] / docs / development / IDE - Visual Studio Code with Windows 10.md
blobffd0383c555951f4ccf3076f68c1065a551a88f4
1 # IDE - Visual Studio Code with Windows 10
3 ![Visual Studio Code](assets/vscode01.png)
5 [Visual Studio Code](https://code.visualstudio.com/) is probably the best free option for all Windows 10 users. It provides almost seamless integration with WSL running Ubuntu, syntax highlighting, building, and hardware debugging.
7 ## Setup
9 1. Setup build environment using [generic WSL guide](Building%20in%20Windows%2010%20with%20Linux%20Subsystem.md)
10 1. Download and install [Visual Studio Code](https://code.visualstudio.com/)
11 1. From the VS Code Extensions download [Remote - WSL](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-wsl) plugin
12 1. Open INAV folder
13 1. Use `Ctrl + Shift + P` to run option `Remote-WSL: Reopen Folder in WSL`
14 1. Allow firewall and other permissions if requested
15 1. Install plugins in WSL workspace:
16     1. [C/C++ from Microsoft](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) for C/C++ support
17     1. [Bookmarks](https://marketplace.visualstudio.com/items?itemName=alefragnani.Bookmarks) for simpler navigation
18 1. Configure the environment using the following snippets as a base
20 ### C propertiues
22 Edit file `./.vscode/c_cpp_properties.json` to setup enabled `defines`
24 ```
26     "configurations": [
27         {
28             "name": "Win32",
29             "includePath": [
30                 "${workspaceRoot}",
31                 "${workspaceRoot}/src/main/**"
32             ],
33             "browse": {
34                 "limitSymbolsToIncludedHeaders": false,
35                 "path": [
36                     "${workspaceRoot}/**"
37                 ]
38             },
39             "intelliSenseMode": "msvc-x64",
40             "cStandard": "c11",
41             "cppStandard": "c++17",
42             "defines": [
43                 "NAV_FIXED_WING_LANDING",
44                 "USE_OSD",
45                 "USE_GYRO_NOTCH_1",
46                 "USE_GYRO_NOTCH_2",
47                 "USE_DTERM_NOTCH",
48                 "USE_ACC_NOTCH",
49                 "USE_GYRO_BIQUAD_RC_FIR2",
50                 "USE_D_BOOST",
51                 "USE_SERIALSHOT",
52                 "USE_ANTIGRAVITY",
53                 "USE_ASYNC_GYRO_PROCESSING",
54                 "USE_RPM_FILTER",
55                 "USE_GLOBAL_FUNCTIONS",
56                 "USE_DYNAMIC_FILTERS",
57                 "USE_DSHOT",
58                 "FLASH_SIZE 480",
59                 "USE_I2C_IO_EXPANDER",
60                 "USE_PCF8574",
61                 "USE_ESC_SENSOR"
62             ]
63         }
64     ],
65     "version": 4
67 ```
69 ### Tasks
71 Edit `./.vscode/tasks.json` to enable Building with `Ctrl + Shift + B` keyboard shortcut and from Command Console.
73 ```
75     // See https://go.microsoft.com/fwlink/?LinkId=733558
76     // for the documentation about the tasks.json format
77     "version": "2.0.0",
78     "tasks": [
79         {
80             "label": "Install/Update CMAKE",
81             "type": "shell",
82             "command": "mkdir -p build && cd build && cmake ..",
83             "group": "build",
84             "problemMatcher": [],
85             "options": {
86                 "cwd": "${workspaceFolder}"
87             }
88         },
89         {
90                         "label": "Compile autogenerated docs",
91                         "type": "shell",
92                         "command": "python3 src/utils/update_cli_docs.py",
93                         "problemMatcher": [],
94                         "options": {
95                                 "cwd": "${workspaceFolder}"
96                         }
97                 },
98         // Example of building a single target
99        {
100             "label": "Build Matek F722-WPX",
101             "type": "shell",
102             "command": "make MATEKF722WPX",
103             "group": "build",
104             "problemMatcher": [],
105             "options": {
106                 "cwd": "${workspaceFolder}/build"
107             }
108         },
109         // Example of building multiple targets
110         {
111             "label": "Build Matek F405-STD & WING",
112             "type": "shell",
113             "command": "make MATEKF405 MATEKF405SE",
114             "group": "build",
115             "problemMatcher": [],
116             "options": {
117                 "cwd": "${workspaceFolder}/build"
118             }
119         }
120     ]